package com.example.uilearning;

import android.app.Activity;
import android.os.Bundle;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TextView;

public class RadioAndCheckButtonActivity extends Activity {
	private RadioGroup gp;
	private TextView show;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_radio_and_check_button);
		gp= (RadioGroup) findViewById(R.id.gp);
		show = (TextView)findViewById(R.id.show);
		gp.setOnCheckedChangeListener(new OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(RadioGroup group, int checkedId) {
				// TODO Auto-generated method stub
				String showStr = (checkedId == R.id.male ? "您的性别是男人"
						: "您的性别是女人");
				show.setText(showStr);

			}
		});
	}
}
